<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<title>beagleoncreate: D:/backups/Desktop/beagleoncreate/trunk/sonar/Gpio.h Source File</title>

<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript">
  $(document).ready(initResizable);
</script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
  $(document).ready(function() { searchBox.OnSelectItem(0); });
</script>

</head>
<body>
<div id="top"><!-- do not remove this div! -->


<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  
  <td id="projectlogo"><img alt="Logo" src="logo.png"/></td>
  
  
  <td style="padding-left: 0.5em;">
   <div id="projectname">beagleoncreate
   
   </div>
   <div id="projectbrief">Beagleboard sensor interface on iRobot Create with sonar and USB webcam through WiFi</div>
  </td>
  
  
  
 </tr>
 </tbody>
</table>
</div>

<!-- Generated by Doxygen 1.7.6.1 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Main&#160;Page</span></a></li>
      <li><a href="pages.html"><span>Related&#160;Pages</span></a></li>
      <li><a href="annotated.html"><span>Classes</span></a></li>
      <li class="current"><a href="files.html"><span>Files</span></a></li>
      <li>
        <div id="MSearchBox" class="MSearchBoxInactive">
        <span class="left">
          <img id="MSearchSelect" src="search/mag_sel.png"
               onmouseover="return searchBox.OnSearchSelectShow()"
               onmouseout="return searchBox.OnSearchSelectHide()"
               alt=""/>
          <input type="text" id="MSearchField" value="Search" accesskey="S"
               onfocus="searchBox.OnSearchFieldFocus(true)" 
               onblur="searchBox.OnSearchFieldFocus(false)" 
               onkeyup="searchBox.OnSearchFieldChange(event)"/>
          </span><span class="right">
            <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
          </span>
        </div>
      </li>
    </ul>
  </div>
  <div id="navrow2" class="tabs2">
    <ul class="tablist">
      <li><a href="files.html"><span>File&#160;List</span></a></li>
      <li><a href="globals.html"><span>File&#160;Members</span></a></li>
    </ul>
  </div>
</div>
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
  initNavTree('_gpio_8h.html','');
</script>
<div id="doc-content">
<div class="header">
  <div class="headertitle">
<div class="title">D:/backups/Desktop/beagleoncreate/trunk/sonar/Gpio.h</div>  </div>
</div><!--header-->
<div class="contents">
<a href="_gpio_8h.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="preprocessor">#ifndef GPIO_H</span>
<a name="l00002"></a>00002 <span class="preprocessor"></span><span class="preprocessor">#define GPIO_H</span>
<a name="l00003"></a>00003 <span class="preprocessor"></span>
<a name="l00004"></a>00004 <span class="preprocessor">#include &lt;time.h&gt;</span>
<a name="l00009"></a><a class="code" href="_gpio_8h.html#af85a50a6f2ad829c847ac5250c40b0c1">00009</a> <span class="keyword">enum</span> <a class="code" href="_gpio_8h.html#af85a50a6f2ad829c847ac5250c40b0c1">GpioVal</a>
<a name="l00010"></a>00010 { 
<a name="l00012"></a><a class="code" href="_gpio_8h.html#af85a50a6f2ad829c847ac5250c40b0c1a0c3a1dacf94061154b3ee354359c5893">00012</a>         <a class="code" href="_gpio_8h.html#af85a50a6f2ad829c847ac5250c40b0c1a0c3a1dacf94061154b3ee354359c5893">HIGH</a>, 
<a name="l00014"></a><a class="code" href="_gpio_8h.html#af85a50a6f2ad829c847ac5250c40b0c1a6a226f4143ca3b18999551694cdb72a8">00014</a>         <a class="code" href="_gpio_8h.html#af85a50a6f2ad829c847ac5250c40b0c1a6a226f4143ca3b18999551694cdb72a8">LOW</a>,    
<a name="l00016"></a><a class="code" href="_gpio_8h.html#af85a50a6f2ad829c847ac5250c40b0c1a76819c61cc4d632340f4c63c6861b82b">00016</a>         <a class="code" href="_gpio_8h.html#af85a50a6f2ad829c847ac5250c40b0c1a76819c61cc4d632340f4c63c6861b82b">UNKNOWNVAL</a>      
<a name="l00017"></a>00017 };
<a name="l00018"></a>00018 
<a name="l00020"></a><a class="code" href="_gpio_8h.html#a5d25b5873c978e7acc8ad1a380cbc165">00020</a> <span class="keyword">enum</span> <a class="code" href="_gpio_8h.html#a5d25b5873c978e7acc8ad1a380cbc165">GpioEdge</a>
<a name="l00021"></a>00021 {
<a name="l00023"></a><a class="code" href="_gpio_8h.html#a5d25b5873c978e7acc8ad1a380cbc165ad93abe7aced82e9a4fcac4127a36ece3">00023</a>         <a class="code" href="_gpio_8h.html#a5d25b5873c978e7acc8ad1a380cbc165ad93abe7aced82e9a4fcac4127a36ece3">RISING</a>, 
<a name="l00025"></a><a class="code" href="_gpio_8h.html#a5d25b5873c978e7acc8ad1a380cbc165ad24712a6a30c1d431b927d1ba2f84b66">00025</a>         <a class="code" href="_gpio_8h.html#a5d25b5873c978e7acc8ad1a380cbc165ad24712a6a30c1d431b927d1ba2f84b66">FALLING</a>,
<a name="l00027"></a><a class="code" href="_gpio_8h.html#a5d25b5873c978e7acc8ad1a380cbc165a627abe5a430420baf29ebe1940a7f2fb">00027</a>         <a class="code" href="_gpio_8h.html#a5d25b5873c978e7acc8ad1a380cbc165a627abe5a430420baf29ebe1940a7f2fb">BOTH</a>            
<a name="l00028"></a>00028 };
<a name="l00029"></a>00029 
<a name="l00030"></a><a class="code" href="class_gpio.html">00030</a> <span class="keyword">class </span><a class="code" href="class_gpio.html" title="This class is the class to handle any gpio related actions.">Gpio</a>
<a name="l00031"></a>00031 {
<a name="l00032"></a>00032 <span class="keyword">public</span>:
<a name="l00033"></a>00033         <a class="code" href="class_gpio.html#a5b18c988a3c1d2a4c1581f2b299c3b84" title="A constructor for Gpio class. Also export the port in the constructor.">Gpio</a>(<span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> pinNum, <span class="keywordtype">bool</span> isOut = <span class="keyword">true</span>);
<a name="l00034"></a>00034         <a class="code" href="class_gpio.html#a08d5f1b18ad260f1812706057b14ee0e" title="A destructor for Gpio class. Unexport here.">~Gpio</a>();
<a name="l00035"></a>00035         
<a name="l00036"></a>00036         <span class="keywordtype">int</span> <a class="code" href="class_gpio.html#a81b3ac6027516e2d64d68d56a5bfdcfd" title="Get the gpio pin value when the pin is in input mode.">GetValue</a>(<a class="code" href="_gpio_8h.html#af85a50a6f2ad829c847ac5250c40b0c1">GpioVal</a> &amp; value);
<a name="l00037"></a>00037         
<a name="l00038"></a>00038         <span class="keywordtype">int</span> <a class="code" href="class_gpio.html#a7bab06d29120f9b6d724429fcac167d2" title="Set the trigger edge when the gpio is in input mode.">SetEdge</a>(<a class="code" href="_gpio_8h.html#a5d25b5873c978e7acc8ad1a380cbc165">GpioEdge</a> edge);
<a name="l00039"></a>00039         <span class="keywordtype">int</span> <a class="code" href="class_gpio.html#a9cd5e02f4ea1cb55ce6165e921012041" title="Set the gpio pin value when the gpio pin is in output mode.">SetValue</a>(<a class="code" href="_gpio_8h.html#af85a50a6f2ad829c847ac5250c40b0c1">GpioVal</a> value);
<a name="l00040"></a>00040         <span class="keywordtype">int</span> <a class="code" href="class_gpio.html#a1d3e66e5ef3d40de97d06d4ced6849a5" title="Set the gpio pin direction.">SetDir</a>(<span class="keywordtype">bool</span> out); 
<a name="l00041"></a>00041         
<a name="l00042"></a>00042         <span class="keywordtype">int</span> <a class="code" href="class_gpio.html#a3dbc162200988c245e3ed85fa5db3b5a" title="Polling the gpio input and record the time when the trigger occurred.">Poll</a>(<span class="keywordtype">int</span> usec, <span class="keyword">struct</span> timespec &amp; timeOfInterrupt);
<a name="l00043"></a>00043         
<a name="l00044"></a>00044 <span class="keyword">private</span>:
<a name="l00045"></a>00045         <span class="keywordtype">bool</span> _isOut;
<a name="l00046"></a>00046         <span class="keywordtype">int</span> _fd;
<a name="l00047"></a>00047         <a class="code" href="_gpio_8h.html#af85a50a6f2ad829c847ac5250c40b0c1">GpioVal</a> _curVal;
<a name="l00048"></a>00048         <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> _pinNum;
<a name="l00049"></a>00049         
<a name="l00050"></a>00050         <span class="keywordtype">int</span> Export();
<a name="l00051"></a>00051         <span class="keywordtype">int</span> Unexport();
<a name="l00052"></a>00052         <span class="keywordtype">void</span> OpenFd();
<a name="l00053"></a>00053         <span class="keywordtype">void</span> CloseFd();
<a name="l00054"></a>00054         
<a name="l00055"></a>00055 };
<a name="l00056"></a>00056 
<a name="l00057"></a>00057 <span class="preprocessor">#endif</span>
</pre></div></div><!-- contents -->
</div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
<a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(0)"><span class="SelectionMark">&#160;</span>All</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark">&#160;</span>Classes</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark">&#160;</span>Files</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(3)"><span class="SelectionMark">&#160;</span>Functions</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(4)"><span class="SelectionMark">&#160;</span>Variables</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(5)"><span class="SelectionMark">&#160;</span>Enumerations</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(6)"><span class="SelectionMark">&#160;</span>Enumerator</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(7)"><span class="SelectionMark">&#160;</span>Defines</a></div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

  <div id="nav-path" class="navpath">
    <ul>
      <li class="navelem"><a class="el" href="_gpio_8h.html">Gpio.h</a>      </li>

    <li class="footer">Generated on Sun Feb 12 2012 18:23:34 for beagleoncreate by
    <a href="http://www.doxygen.org/index.html">
    <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.7.6.1 </li>
   </ul>
 </div>


</body>
</html>
